import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;

public class VEVENT {

	static DateFormat dateFormat = new SimpleDateFormat("yyyyMMdd'T'HHmmss");
	private static String dtStamp = dtStamp();
	private static String sequence = "SEQUENCE:0";
	private static String uid = "UID:default";
	private static String dtStart = "";
	private static String dtEnd = "";
	private static String category = "";
	private static String description = "";

	// constructor
	public VEVENT() {
	}

	// general format of the ics file printed as a String
	public String format() {
		String output = "BEGIN:VEVENT\n" + dtStamp + "\n" + sequence + "\n"
				+ uid + "\n" + dtStart + "\n" + dtEnd + "\n" + category + "\n"
				+ description + "\n" + "END:VEVENT\n";
		return output;
	}

	// set sequence
	public void setSequence(String n) {
		this.sequence = "SEQUENCE" + Integer.parseInt(n);
	}

	// get sequence
	public String getSequence() {
		return this.sequence;
	}

	// sets uid
	public void setUID(String id) {
		this.uid = "UID:" + id;
	}

	// gets uid
	private String getUID() {
		return this.uid;
	}

	// returns the time stamp
	public static String dtStamp() {
		return "DTSTAMP:"
				+ dateFormat.format(new GregorianCalendar().getTime());
	}

	// sets start time
	public void setStart(Calendar cal) {
		this.dtStart = "DTSTART:" + dateFormat.format(cal.getTime());
	}

	// get start time
	public String getStart() {
		return this.dtStart;
	}

	// get end time
	public String getEnd() {
		return this.dtEnd;
	}

	// sets end time
	public void setEnd(Calendar cal) {
		this.dtEnd = "DTEND:" + dateFormat.format(cal.getTime());
	}

	// returns calendar with time specified in params
	public Calendar setDate(int year, int month, int date, int hourOfDay,
			int minute, int seconds) {
		Calendar cal = new GregorianCalendar();
		cal.set(year, month - 1, date, hourOfDay, minute, seconds);
		return cal;
	}

	// sets category
	public void setCategory(String str) {
		this.category = "CATEGORY:" + str;
	}

	// gets category
	public String getCategory() {
		return this.category;
	}

	// sets category
	public void setDescription(String str) {
		this.description = "DESCRIPTION:" + str;
	}

	// gets category
	public String getDescription() {
		return this.description;
	}

}
